package com.yuwei.smartpark
import android.os.CountDownTimer
import com.alibaba.android.arouter.launcher.ARouter
import com.tencent.mmkv.MMKV
import com.yuwei.base.BaseViewActivity
import com.yuwei.common.path.RouterPath
import com.yuwei.smartpark.databinding.ActivitySplashBinding

/**
 * 1.app介绍（轮播图，动画，视频）
 * 2.接入广告（开屏广告为主）
 * 3.第一次变装只会展示APP功能，二次打开就有广告
 * 4.选择类型兴趣标签（为后期做内容推荐）
 */
class SplashActivity : BaseViewActivity<ActivitySplashBinding>() {
    override fun initView() {
        val countDownTimer = object :CountDownTimer(5000,1000){
            override fun onTick(millisUntilFinished: Long) {
                binding.tvTime.text = "${millisUntilFinished/1000}s"
            }

            override fun onFinish() {
                ARouter.getInstance().build(RouterPath.MODULE_MAIN_ACTIVITY).navigation()
                finish()
            }
        }.start()
        binding.tvSkip.setOnClickListener {
            countDownTimer.cancel()
            ARouter.getInstance().build(RouterPath.MODULE_MAIN_ACTIVITY).navigation()
            finish()
        }
        val isFirstBoot = MMKV.defaultMMKV().decodeBool("isFirstBool",true)
        if (isFirstBoot){
            MMKV.defaultMMKV().encode("isFirstBool",false)
        }else{

        }
    }

    override fun initData() {

    }

//    override fun onStart() {
//        super.onStart()
//        //检查启动时间
//        reportFullyDrawn()
//    }

}